home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.478 < prev    next >
Text File  |  1996-02-12  |  28KB  |  731 lines

  1. Frequently Asked Questions (FAQS);faqs.478
  2.  
  3.  
  4.  
  5. The weight of the rope and the weight is one-half as much again as the
  6. difference between the weight of the weight and the weight of the weight
  7. plus the weight of the monkey.
  8.  
  9. How long is the rope?
  10.  
  11. ==> physics/monkey.s <==
  12. The most difficult thing about this puzzle, as you probably expected,
  13. is translating all the convoluted problem statements into equations...
  14. the solution is pretty trivial after that.  So...
  15.  
  16. Let:
  17.     m represent monkey
  18.     M represent mother of monkey
  19.     w represent weight
  20.     r represent rope
  21.  
  22.     W[x] = present weight of x (x is m, M, w, or r)
  23.     A[x,t] = age of x at time t (x is M or M, t is one of T1 thru T4)
  24.  
  25.     T1 = time at which mother is 3 times as old as monkey
  26.     T2 = time at which monkey is 3 times as old as mother at T1
  27.     T3 = time at which mother is half as old as monkey at T2
  28.     T4 = present time
  29.  
  30. For the ages, we have:
  31.  
  32.     A[M,T1] = 3*A[m,T1]
  33.     A[m,T2] = 3*A[M,T1] = 9*A[m,T1]
  34.     A[M,T3] = A[m,T2]/2 = 9*A[m,T1]/2
  35.     A[m,T3] = A[m,T1] + (T3-T1)
  36.         = A[m,T1] + (A[M,T3]-A[M,T1])
  37.         = A[m,T1] + (9*A[M,T1]/2 - 3*A[m,T1])
  38.         = 5*A[m,T1]/2
  39.     A[M,T4] = 2*A[m,T3] = 5*A[m,T1]
  40.     A[m,T4] = A[m,T1] + (T4-T1)
  41.         = A[m,T1] + (A[M,T4]-A[M,T1])
  42.         = A[m,T1] + (5*A[m,T1] - 3*A[m,T1])
  43.         = 3*A[m,T1]
  44.  
  45. The present ages of monkey and mother sum to 4, so we have
  46.  
  47.     A[m,T4]   + A[M,T4]   = 4
  48.     3*A[m,T1] + 5*A[m,T1] = 4
  49.             8*A[m,T1] = 4
  50.               A[m,T1] = 1/2
  51.  
  52. Thus:
  53.     A[M,T4] = 5/2
  54.     A[m,T4] = 3/2
  55.  
  56. Now for the weights, translating everything to ounces:
  57.  
  58. Monkey's weight in lbs = mother's age in years, so:
  59.  
  60.     W[m] = 16*5/2 = 40
  61.  
  62. Weight and monkey are same weight, so:
  63.  
  64.     W[w] = W[m] = 40
  65.  
  66. The last paragraph in the problem translates into:
  67.  
  68.     W[r]+W[w] = (3/2)*((W[w]+W[m])-W[w])
  69.     W[r]+ 40  = (3/2)*(( 40 + 40 )- 40 )
  70.     W[r]+ 40  = 60
  71.     W[r]      = 20
  72.  
  73. The rope weighs 4 ounces per foot, so its length is 5 feet.
  74.  
  75. ==> physics/particle.p <==
  76. What is the longest time that a particle can take in travelling between two
  77. points if it never increases its acceleration along the way and reaches the
  78. second point with speed V?
  79.  
  80. ==> physics/particle.s <==
  81. Assumptions:
  82.  
  83. 1. x(0) = 0; x(T) = X
  84.  
  85. 2. v(0) = 0; v(T) = V
  86.  
  87. 3. d(a)/dt <= 0
  88.  
  89. Solution:
  90.  
  91. a(t) = constant = A = V^2/2X which implies T = 2X/V.
  92.  
  93. Proof:
  94.  
  95. Consider assumptions as they apply to f(t) = A * t - v(t):
  96.  
  97. 1. integral from 0 to T of f = 0
  98.  
  99. 2. f(0) = f(T) = 0
  100.  
  101. 3. d^2(f)/dt^2 <= 0
  102.  
  103. From the mean value theorem, f(t) = 0.  QED.
  104.  
  105. ==> physics/pole.in.barn.p <==
  106. Accelerate a pole of length l to a constant speed of 90% of the speed of
  107. light (.9c).  Move this pole towards an open barn of length .9l (90%
  108. the length of the pole).  Then, as soon as the pole is fully inside the
  109. barn, close the door.  What do you see and what actually happens?
  110.  
  111. ==> physics/pole.in.barn.s <==
  112. What the observer sees depends upon where the observer is, due to
  113. the finite speed of light.
  114.  
  115. For definiteness, assume the forward end of the pole is marked "A" and
  116. the after end is marked "B".  Let's also assume there is a light source
  117. inside the barn, and that the pole stops moving as soon as end "B" is
  118. inside the barn.
  119.  
  120. An observer inside the barn next to the door will see the following
  121. sequence of events:
  122.  
  123.     1.  End "A" enters the barn and continues toward the back.
  124.     2.  End "B" enters the barn and stops in front of the observer.
  125.     3.  The door closes.
  126.     4.  End "A" continues moving and penetrates the barn at the far end.
  127.     5.  End "A" stops outside the barn.
  128.  
  129. An observer at the other end of the barn will see:
  130.  
  131.     1.  End "A" enters the barn.
  132.     2.  End "A" passes the observer and penetrates the back of the barn.
  133.     3.  If the pole has markings on it, the observer will notice the part
  134.         nearest him has stopped moving.  However, both ends are still
  135.         moving.
  136.     4.  End "A" stops moving outside the barn.
  137.     5.  End "B" continues moving until it enters the barn and then stops.
  138.     6.  The door closes.
  139.  
  140. After the observers have subtracted out the effects of the finite speed
  141. of light on what they see, both observers will agree on what happened:
  142. The pole entered the barn; the door closed so that the pole was
  143. completely contained within the barn; as the pole was being stopped it
  144. elongated and penetrated the back wall of the barn.
  145.  
  146. Things are different if you are riding along with the pole.  The pole
  147. is never inside the barn since it won't fit.  End A of the pole penetrates
  148. the rear wall of the barn before the door is closed.
  149.  
  150. If the wall of the barn is impenetrable, in all the above scenarios insert
  151. the wording "End A of the pole explodes" for "End A penetrates the barn."
  152.  
  153. ==> physics/resistors.p <==
  154. What are the resistances between lattices of resistors in the shape of a:
  155.  
  156. 1. Cube
  157.  
  158. 2. Platonic solid
  159.  
  160. 3. Hypercube
  161.  
  162. 4. Plane sheet
  163.  
  164. 5. Continuous sheet
  165.  
  166. ==> physics/resistors.s <==
  167. 1. Cube
  168.  
  169. The key idea is to observe that if you can show that two
  170. points in a circuit must be at the same potential, then you can
  171. connect them, and no current will flow through the connection and the
  172. overall properties of the circuit remain unchanged.  In particular, for
  173. the cube, there are three resistors leaving the two "connection
  174. corners".  Since the cube is completely symmetrical with respect to the
  175. three resistors, the far sides of the resistors may be connected
  176. together.  And so we end up with:
  177.  
  178.     |---WWWWWW---|    |---WWWWWW---|
  179.         |            |    |            |
  180.      *--+---WWWWWW---+----+---WWWWWW---+---*
  181.     |            |    |            |
  182.     |---WWWWWW---|    |---WWWWWW---|
  183.  
  184. 2. Platonic Solids
  185.  
  186. Same idea for 8 12 and 20, since you use the symmetry to identify
  187. equi-potential points.  The tetrahedron is hair more subtle:
  188.  
  189.     *---|---WWWWWW---|---*
  190.     |\          /|
  191.     W W        W W
  192.     W  W      W  W
  193.     W   W    W   W
  194.     |    \  /    |
  195.      \    ||     |
  196.           \    |    /
  197.        \   W   /
  198.         \  W  /   <-------
  199.          \ W /
  200.           \|/
  201.            +
  202.  
  203. By symmetry, the endpoints of the marked resistor are equi-potential.  Hence
  204. they can be connected together, and so it becomes a simple:
  205.  
  206.     *---+---WWWWW---+----*
  207.     |           |
  208.     +-WWW   WWW-+
  209.     |    |-|    |
  210.     |-WWW   WWW-|
  211.  
  212. 3. Hypercube
  213.  
  214. Think of injecting a constant current I into the start vertex.
  215. It splits (by symmetry) into n equal currents in the n arms; the current of
  216. I/n then splits into I/n(n-1), which then splits into I/[n(n-1)(n-1)] and so
  217. on till the halfway point, when these currents start adding up. What is the
  218. voltage difference between the antipodal points? V = I x R; add up the voltages
  219. along any of the paths:
  220. n even:                                                         (n-2)/2
  221.      V = 2{I/n + I/(n(n-1)) + I/(n(n-1)(n-1)) + ... +  I/(n(n-1)       )}
  222.  
  223. n odd:                                                      (n-3)/2
  224.  V = 2{I/n + I/(n(n-1)) + I/(n(n-1)(n-1)) + ... +  I/(n(n-1)       )}    (n-1)/2
  225.                                                                + I/(n(n-1)     )
  226. And R = V/I i.e. replace the Is in the above expression by 1s.
  227.  
  228. For the 3-cube: R = 2{1/3} + 1/(3x2) = 5/6 ohm
  229. For the 4-cube: R = 2{1/4 + 1/(4x3)} = 2/3 ohm
  230.  
  231. This formula yields the resistance from root to root of
  232. two (n-1)-ary trees of height n/2 with their end nodes identified
  233. (-when n is even; something similar when n is odd).
  234. Coincidentally, the 4-cube is such an animal and thus the answer
  235. 2/3 ohms is correct in that case.
  236. However, it does not provide the solution for n >= 5, as the hypercube
  237. does not have quite as many edges as were counted in the formula above.
  238.  
  239. 4. The Infinite Plane
  240.  
  241. For an infinite lattice: First inject a constant current I at a point; figure
  242. out the current flows (with heavy use of symmetry). Remove that current. Draw
  243. out a current I from the other point of interest (or inject a negative current)
  244. and figure out the flows (identical to earlier case, but displaced and in the
  245. other direction). By the principle of superposition, if you inject a current I
  246. into point a and take out a current I at point b at the same time, the currents
  247. in the paths are simply the sum of the currents obtained in the earlier two
  248. simpler cases. As in the n-cube, find the voltage between the points of
  249. interest, divide by I and voila'!
  250.  
  251. As an illustration, in the adjacent points case: we have a current of I/4 in
  252. each of the four resistors:
  253.  
  254.     ^                |
  255.     |                v
  256.  <--o-->          -->o<--
  257.     |                ^
  258.     v                |
  259.  (inject)          (take out)
  260. And adding the currents, we have I/2 in the resistor connecting the two points.
  261. Therefore V=(1 ohm) x I/2 and effective resistance between the points = 1/2 ohm.
  262.  
  263. You can (and showed how to) use symmetry to obtain the equivalent resistance
  264. of 1/2 between two adjacent nodes; but I doubt that symmetry alone will give you
  265. even the equivalent resistance of 2/pi between two diagonally adjacent nodes.
  266. [More generally, the equivalent resistance between two nodes k diagonal units
  267. apart is (2/pi)(1+1/3+1/5+...+1/(2k-1)); that, plus symmetry and the known
  268. equivalent resistance between two adjacent nodes, is sufficient to derive all
  269. equivalent resistances in the lattice.
  270.  
  271. 5. Continuous sheet
  272.  
  273. Doesn't the resistance diverge in that case?  The problem is that you can't
  274. inject current at a point.
  275.  
  276. cf. "Random Walks and Electric Networks", by Doyle and Snell, published by the
  277. Mathematical Association of America.
  278.  
  279. ==> physics/sail.p <==
  280. A sailor is in a sailboat on a river.  The water (current) is flowing
  281. downriver at a velocity of 3 knots with respect to the land.  The wind
  282. (air velocity) is zero, with respect to the land.  The sailor wants
  283. to proceed downriver as quickly as possible, maximizing his downstream
  284. speed with respect to the land.
  285.  
  286. Should he raise the sail, or not?
  287.  
  288. ==> physics/sail.s <==
  289. Depends on the sail.  If the boat is square-rigged, then not, since
  290. raising the sail will simply increase the air resistance.
  291.  
  292. If the sailor has a fore-and-aft rig, then he should, since he can then
  293. tack into the wind.  (Imagine the boat in still water with a 3-knot head
  294. wind).
  295.  
  296. ==> physics/skid.p <==
  297. What is the fastest way to make a 90 degree turn on a slippery road?
  298.  
  299. ==> physics/skid.s <==
  300. For higher speeds (measured at a small distance from the point of initiation
  301. of a sharp turn) the fastest way round is to "outside loop" - that is, steer
  302. away from the curve, and do a kidding 270.
  303.  
  304. This technique is taught in advanced driving schools.
  305.  
  306. References:
  307.  
  308. M. Freeman and P. Palffy, American Journal of Physics, vol 50, p. 1098, 1982.
  309. P. Palffy and Unruh, American Journal of Physics, vol 49, p. 685, 1981.
  310.  
  311. ==> physics/spheres.p <==
  312. Two spheres are the same size and weight, but one is hollow.  They are
  313. made of uniform material, though of course not the same material.  Without
  314. a minimum of apparatus, how can I tell which is hollow?
  315.  
  316. ==> physics/spheres.s <==
  317. Since the balls have equal diameter and equal mass, their volume and
  318. density are also equal.  However, the mass distribution is not equal,
  319. so they will have different moments of inertia - the hollow sphere has
  320. its mass concentrated at the outer edge, so its moment of inertia will
  321. be greater than the solid sphere.  Applying a known torque and observing
  322. which sphere has the largest angular acceleration will determine which
  323. is which.  An easy way to do this is to "race" the spheres down an
  324. inclined plane with enough friction to prevent the spheres from sliding.
  325. Then, by conservation of energy:
  326.  
  327.          mgh = 1/2 mv^2 + 1/2 Iw^2
  328.  
  329. Since the spheres are rolling without sliding, there is a relationship
  330. between velocity and angular velocity:
  331.  
  332.         w = v / r
  333.  
  334. so
  335.  
  336.          mgh = 1/2 mv^2 + 1/2 I (v^2 / r^2) = 1/2 (m + I/r^2) v^2
  337.  
  338. and
  339.  
  340.          v^2 = 2mgh / (m + I / r^2)
  341.  
  342. From this we can see that the sphere with larger moment of inertia (I) will
  343. have a smaller velocity when rolled from the same height, if mass and radius
  344. are equal with the other sphere.  Thus the solid sphere will roll faster.
  345.  
  346. ==> physics/wind.p <==
  347. Is a round-trip by airplane longer or shorter if there is wind blowing?
  348.  
  349. ==> physics/wind.s <==
  350. It will take longer, by the ratio (s^2)/(s^2 - w^2) where s is
  351. the plane's speed, and w is the wind speed.  The stronger the wind the
  352. longer it will take, up until the wind speed equals the planes speed, at
  353. which point the plane will never finish the trip.
  354.  
  355. Math:
  356.     s = plane's speed
  357.     w = wind speed
  358.     d = distance in one direction
  359.  
  360.     d / (s + w)    = time to complete leg flying with the wind
  361.     d / (s - w)    = time to complete leg flying against the wind
  362.     d / (s + w) + d / (s - w)    = round trip time
  363.  
  364.     d / (s + w) + d / (s - w)    = ratio of flying with wind to
  365.     -------------------------      flying with no wind (bottom of
  366.        d / s + d / s          equation is top with w = 0)
  367.     
  368.     this simplifies to s^2 / (s^2 - w^2).
  369.  
  370. ==> probability/amoeba.p <==
  371. A jar begins with one amoeba.  Every minute, every amoeba
  372. turns into 0, 1, 2, or 3 amoebae with probability 25%
  373. for each case ( dies, does nothing, splits into 2, or splits
  374. into 3).  What is the probability that the amoeba population
  375. eventually dies out?
  376.  
  377. ==> probability/amoeba.s <==
  378. If p is the probability that a single amoeba's descendants will die
  379. out eventually, the probability that N amoebas' descendents will all
  380. die out eventually must be p^N, since each amoeba is independent of
  381. every other amoeba.  Also, the probability that a single amoeba's
  382. descendants will die out must be independent of time when averaged
  383. over all the possibilities.  At t=0, the probability is p, at t=1 the
  384. probability is 0.25(p^0+p^1+p^2+p^3), and these probabilities must be
  385. equal.  Extinction probability p is a root of f(p)=p.  In this case,
  386.  p = sqrt(2)-1.
  387.  
  388. The generating function for the sequence P(n,i), which gives the
  389. probability of i amoebas after n minutes, is f^n(x), where f^n(x) ==
  390. f^(n-1) ( f(x) ), f^0(x) == x .  That is, f^n is the nth composition
  391. of f with itself.
  392.  
  393. Then f^n(0) gives the probability of 0 amoebas after n minutes, since
  394. f^n(0) = P(n,0). We then note that:
  395.  
  396.     f^(n+1)(x) = ( 1 + f^n(x) + (f^n(x))^2 + (f^n(x))^3 )/4
  397.  
  398. so that if f^(n+1)(0) -> f^n(0) we can solve the equation.
  399.  
  400. The generating function also gives an expression for the expectation
  401. value of the number of amoebas after n minutes. This is d/dx(f^n(x))
  402. evaluated at x=1. Using the chain rule we get f'(f^(n-1)(x))*d/dx(f^(n-1)(x))
  403. and since f'(1) = 1.5  and f(1) = 1, we see that the result is just
  404. 1.5^n, as might be expected.
  405.  
  406. ==> probability/apriori.p <==
  407. An urn contains one hundred white and black balls.  You sample one hundred
  408. balls with replacement and they are all white.  What is the probability
  409. that all the balls are white?
  410.  
  411. ==> probability/apriori.s <==
  412. This question cannot be answered with the information given.
  413.  
  414. In general, the following formula gives the conditional probability
  415. that all the balls are white given you have sampled one hundred balls
  416. and they are all white:
  417.  
  418.     P(100 white | 100 white samples) =
  419.  
  420.             P(100 white samples | 100 white) * P(100 white)
  421.         -----------------------------------------------------------
  422.         sum(i=0 to 100) P(100 white samples | i white) * P(i white)
  423.  
  424. The probabilities P(i white) are needed to compute this formula.  This
  425. does not seem helpful, since one of these (P(100 white)) is just what we
  426. are trying to compute.  However, the following argument can be made:
  427. Before the experiment, all possible numbers of white balls from zero to
  428. one hundred are equally likely, so P(i white) = 1/101.  Therefore, the
  429. odds that all 100 balls are white given 100 white samples is:
  430.  
  431.     P(100 white | 100 white samples) =
  432.  
  433.         1 / ( sum(i=0 to 100) (i/100)^100 ) =
  434.  
  435.         63.6%
  436.  
  437. This argument is fallacious, however, since we cannot assume that the urn
  438. was prepared so that all possible numbers of white balls from zero to one
  439. hundred are equally likely.  In general, we need to know the P(i white)
  440. in order to calculate the P(100 white | 100 white samples).  Without this
  441. information, we cannot determine the answer.
  442.  
  443. This leads to a general "problem": our judgments about the relative
  444. likelihood of things is based on past experience.  Each experience allows
  445. us to adjust our likelihood judgment, based on prior probabilities.  This
  446. is called Bayesian inference.  However, if the prior probabilities are not
  447. known, then neither are the derived probabilities.  But how are the prior
  448. probabilities determined?  For example, if we are brains in the vat of a
  449. diabolical scientist, all of our prior experiences are illusions, and
  450. therefore all of our prior probabilities are wrong.
  451.  
  452. All of our probability judgments indeed depend upon the assumption that
  453. we are not brains in a vat.  If this assumption is wrong, all bets are
  454. off.
  455.  
  456. ==> probability/cab.p <==
  457. A cab was involved in a hit and run accident at night.  Two cab companies,
  458. the Green and the Blue, operate in the city.  Here is some data:
  459.  
  460.     a)  Although the two companies are equal in size, 85% of cab
  461. accidents in the city involve Green cabs and 15% involve Blue cabs.
  462.  
  463.     b)  A witness identified the cab in this particular accident as Blue.
  464. The court tested the reliability of the witness under the same circumstances
  465. that existed on the night of the accident and concluded that the witness
  466. correctly identified each one of the two colors 80% of the time and failed
  467. 20% of the time.
  468.  
  469. What is the probability that the cab involved in the accident was
  470. Blue rather than Green?
  471.  
  472. If it looks like an obvious problem in statistics, then consider the
  473. following argument:
  474.  
  475. The probability that the color of the cab was Blue is 80%!  After all,
  476. the witness is correct 80% of the time, and this time he said it was Blue!
  477.  
  478. What else need be considered?  Nothing, right?
  479.  
  480. If we look at Bayes theorem (pretty basic statistical theorem) we
  481. should get a much lower probability.  But why should we consider statistical
  482. theorems when the problem appears so clear cut?  Should we just accept the
  483. 80% figure as correct?
  484.  
  485. ==> probability/cab.s <==
  486. The police tests don't apply directly, because according to the
  487. wording, the witness, given any mix of cabs, would get the right
  488. answer 80% of the time.  Thus given a mix of 85% green and 15% blue
  489. cabs, he will say 20% of the green cabs and 80% of the blue cabs are
  490. blue.  That's 20% of 85% plus 80% of 15%, or 17%+12% = 29% of all the
  491. cabs that the witness will say are blue.  Of those, only 12/29 are
  492. actually blue.  Thus P(cab is blue | witness claims blue) = 12/29.
  493. That's just a little over 40%.
  494.  
  495. Think of it this way... suppose you had a robot watching parts on a
  496. conveyor belt to spot defective parts, and suppose the robot made a
  497. correct determination only 50% of the time (I know, you should
  498. probably get rid of the robot...).  If one out of a billion parts are
  499. defective, then to a very good approximation you'd expect half your
  500. parts to be rejected by the robot.  That's 500 million per billion.
  501. But you wouldn't expect more than one of those to be genuinely
  502. defective.  So given the mix of parts, a lot more than 50% of the
  503. REJECTED parts will be rejected by mistake (even though 50% of ALL the
  504. parts are correctly identified, and in particular, 50% of the
  505. defective parts are rejected).
  506.  
  507. When the biases get so enormous, things starts getting quite a bit
  508. more in line with intuition.
  509.  
  510. For a related real-life example of probability in the courtroom see
  511. People v. Collins, 68 Cal 2d319 (1968).
  512.  
  513. ==> probability/coincidence.p <==
  514. Name some amazing coincidences.
  515.  
  516. ==> probability/coincidence.s <==
  517. The answer to the question, "Who wrote the Bible," is, of
  518. course, Shakespeare. The King James Version was published in
  519. 1611. Shakespeare was 46 years old then (he turned 47 later in
  520. the year). Look up Psalm 46. Count 46 words from the beginning of
  521. the Psalm. You will find the word "Shake." Count 46 words from
  522. the end of the Psalm. You will find the word "Spear." An obvious
  523. coded message. QED.
  524.  
  525. How many inches in the pole-to-pole diameter of the Earth?  The
  526. answer is almost exactly 500,000,000 inches.  Proof that the inch
  527. was defined by spacemen.
  528.  
  529.  
  530. ==> probability/coupon.p <==
  531. There is a free gift in my breakfast cereal. The manufacturers say
  532. that the gift comes in four different colours, and encourage one to
  533. collect all four (& so eat lots of their cereal). Assuming there is
  534. an equal chance of getting any one of the colours,  what is the
  535. expected number of packets I must plough through to get all four?
  536. Can you generalise to n colours and/or unequal probabilities?
  537.  
  538. Xref: bloom-picayune.mit.edu rec.puzzles:18149 news.answers:3080
  539. Newsgroups: rec.puzzles,news.answers
  540. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!usc!wupost!gumby!destroyer!uunet!questrel!chris
  541. From: uunet!questrel!chris (Chris Cole)
  542. Subject: rec.puzzles FAQ, part 15 of 15
  543. Message-ID: <puzzles-faq-15_717034101@questrel.com>
  544. Followup-To: rec.puzzles
  545. Summary: This posting contains a list of
  546.      Frequently Asked Questions (and their answers).
  547.      It should be read by anyone who wishes to
  548.      post to the rec.puzzles newsgroup.
  549. Sender: chris@questrel.com (Chris Cole)
  550. Reply-To: uunet!questrel!faql-comment
  551. Organization: Questrel, Inc.
  552. References: <puzzles-faq-1_717034101@questrel.com>
  553. Date: Mon, 21 Sep 1992 00:09:54 GMT
  554. Approved: news-answers-request@MIT.Edu
  555. Expires: Sat, 3 Apr 1993 00:08:21 GMT
  556. Lines: 1411
  557.  
  558. Archive-name: puzzles-faq/part15
  559. Last-modified: 1992/09/20
  560. Version: 3
  561.  
  562. ==> probability/coupon.s <==
  563. The problem is well known under the name of "COUPON COLLECTOR PROBLEM".
  564. The answer for n equally likely coupons is
  565. (1)        C(n)=n*H(n)    with H(n)=1+1/2+1/3+...+1/n.
  566. In the unequal probabilities case, with p_i the probability of coupon i,
  567. it becomes
  568. (2)        C(n)=int_0^infty [1-prod_{i=1}^n (1-exp(-p_i*t))] dt
  569. which reduces to (1) when p_i=1/n (An easy exercise).
  570. In the equal probabilities case  C(n)~n log(n). For a Zipf law,
  571. from (2), we have C(n)~n log^2(n).
  572.  
  573. A related problem is the "BIRTHDAY PARADOX" familiar to people
  574. interested in hashing algorithms: With a party of 24 persons,
  575. you are likely (i.e. with probability >50%) to find two with
  576. the same birthday. The non equiprobable case was solved by:
  577.     M. Klamkin and D. Newman, Extensions of the birthday
  578.     surprise, J. Comb. Th. 3 (1967), 279-282.
  579.  
  580. ==> probability/darts.p <==
  581. Peter throws two darts at a dartboard, aiming for the center.  The
  582. second dart lands farther from the center than the first.  If Peter now
  583. throws another dart at the board, aiming for the center, what is the
  584. probability that this third throw is also worse (i.e., farther from
  585. the center) than his first?  Assume Peter's skilfulness is constant.
  586.  
  587. ==> probability/darts.s <==
  588. Since the three darts are thrown independently,
  589. they each have a 1/3 chance of being the best throw.  As long as the
  590. third dart is not the best throw, it will be worse than the first dart.
  591. Therefore the answer is 2/3.
  592.  
  593. Ranking the three darts' results from A (best) to C
  594. (worst), there are, a priori, six equiprobable outcomes.
  595.  
  596. possibility #    1    2    3    4    5    6
  597. 1st throw    A    A    B    B    C    C
  598. 2nd throw    B    C    A    C    A    B
  599. 3rd throw    C    B    C    A    B    A
  600.  
  601. The information from the first two throws shows us that the first
  602. throw will not be the worst, nor the second throw the best.  Thus
  603. possibilities 3, 5 and 6 are eliminated, leaving three equiprobable
  604. cases, 1, 2 and 4.  Of these, 1 and 2 have the third throw worse than
  605. the first; 4 does not.  Again the answer is 2/3.
  606.  
  607. ==> probability/flips.p <==
  608. Consider a run of coin tosses: HHTHTTHTTTHTTTTHHHTHHHHHTHTTHT
  609.  
  610. Define a success as a run of one H or T (as in THT or HTH).  Use two
  611. different methods of sampling.  The first method would consist of
  612. sampling the above data by taking 7 groups of three.  This translates
  613. into the following sequences HHT, HTT, HTT, THT, TTT, HHH, and THH.
  614. In this sample there was one success, THT.  The second method of
  615. sampling could be gotten by taking the groups in a serial sequence.
  616. Another way of explaining the method would be to take the tosses 1, 2,
  617. and 3 as the first set then tosses 2, 3, and 4 as the second set and
  618. so on to produce seven samples.  The samples would be HHT, HTH, THT,
  619. HTT TTH, THT, and HTT, thus giving two success, HTH and THT.  With
  620. these two methods what would be the expected value and the standard
  621. deviation for both methods?
  622.  
  623. ==> probability/flips.s <==
  624. Case 1:
  625.  
  626. Let us start with a simple case: Define success as T and consider
  627. sequences of length 1.  In this case, the two sampling techniques are
  628. equivalent.  Assuming that we are examining a truly random sequence of
  629. T and H.  Thus if n groups of single sequences are considered or a
  630. sequence of length n is considered we will have the following
  631. statistics on the number of successes:
  632.  
  633.     Mean = n/2,  and  standard deviation (sd) = square_root(n)/2
  634.  
  635.  
  636. Case 2:
  637.  
  638. Define success as HT or TH: Here the two sampling techniques need to
  639. be distinguished:
  640.  
  641. Sampling 1:  Take "n" groups of two:  Here probability of getting success in
  642. any group is 1/2 (TH and HT out of 4 possible cases). So the mean and the
  643. standard deviation is same as described in case 1.
  644.  
  645. Sampling 2: Generate a sequence of length "n".  It is easy to show
  646. that (n-1) samples are generated.  The number of successes in this
  647. sequence is same as the number of T to H and H to T transitions.  This
  648. problem is solved in John P. Robinson, Transition Count and Syndrome
  649. are Uncorrelated, IEEE Transactions on Information Theory, Jan 1988.
  650. I will just state the results:
  651.  
  652.   mean = (n-1)/2  and standard deviation = square_root(n-1)/2.
  653.  
  654. In fact, if you want "n" samples in this case you need to generate
  655. length (n+1) sequence.  Then the new mean and standard deviation are
  656. the same as described in Sampling 1. (replace n by n+1).  The
  657. advantage in this sampling (i.e., sampling 2) is that you need only
  658. generate a sequence length of (n+1) to obtain n sample points as
  659. opposed to 2n (n groups of 2) in Sampling 1.
  660.  
  661. OBSERVATION:  The statistics has not changed.
  662.  
  663.  
  664. Case 3:
  665.  
  666. Define success as THT and HTH.
  667.  
  668. Sampling 1: This is a simple situation.  Let us assume "n" samples
  669. need to be generated.  Therefore, "n" groups of three are generated.
  670. The probability of a group being successful is 1/4 (THT and HTH out of
  671. 8 cases).  Therefore mean and standard deviation are:
  672.  
  673.   mean= n/4 and sd= square_root(7n)/4
  674.  
  675. Sampling 2: This is not a simple situation.  Let us generate a random
  676. sequence of length "n".  There will be (n-2) samples in this case.
  677. Use an approach similar to that followed in the Jan 88 IEEE paper.  I
  678. will just state the results.  First we define a function or enumerator
  679. P(n,k) as the number of length "n" sequences that generate "k"
  680. successes.  For example,
  681.  
  682.      P(4,1)= 4  (HHTH, HTHH, TTHT, and THTT are 4 possible length 4 sequences).
  683.  
  684. I derived two generating functions g(x) and h(x) in order to enumerate
  685. P(n,k), they are compactly represented by the following matrix
  686. polynomial.
  687.  
  688.  
  689.             _    _      _     _           _   _
  690.        | g(x) |    | 1   1 | (n-3)   |  4  |
  691.        |      | =  |       |         |     |
  692.        | h(x) |    | 1   x |         |2+2x |
  693.            |_    _|    |_     _|         |_   _|
  694.  
  695. The above is expressed as matrix generating function.  It can be shown
  696. that P(n,k) is the coefficient of the x^k in the polynomial
  697. (g(x)+h(x)).
  698.  
  699. For example, if n=4 we get (g(x)+h(x)) from the matrix generating
  700. function as (10+4x+2x^2).  Clearly, P(4,1) (coefficient of x) is 4 and
  701. P(4,2)=2 ( There are two such sequences THTH, and HTHT).
  702.  
  703. We can show that
  704.  
  705.    mean(k) = (n-2)/4 and sd= square_root(5n-12)/4
  706.  
  707. If we want to compare Sampling 1 with Sampling 2 then in Sampling 2 we
  708. need to generate "n" samples. This can be done by using sequences of length
  709. (n+2).  Then our new statistics would be
  710.  
  711.    mean = n/4 (same as that in sampling 1)
  712.  
  713.    sd = square_root(5n-2)/4 (not the same as in sampling 1)
  714.  
  715.     sd in sampling 2 < sd in sampling 1.
  716.  
  717. This difference can be explained by the fact that in serial sampling
  718. there is dependence on the past state.  For example, if the past
  719. sample was TTT then we know that the next sample can't be a success.
  720. This was not the case in Case 1 or Case 2 (transition count). For
  721. example, in case 2 success was independent of previous sample. That is
  722. if my past sample was TT then my next sample can be TT or TH. The
  723. probability of success in Case 1 and Case 2 is not influenced by past
  724. history).
  725.  
  726. Similar approach can be followed for higher dimensional cases.
  727.  
  728. Here's a C program I had lying around that is relevant to the
  729. current discussion of coin-flipping.  The algorithm is N^3 (for N flips)
  730. but it could certainly be improved.  Compile with
  731.